﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Kandy_K_Stock : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["current"] = "Stock";//current page
        if (Session["user"] != null)//check user
        {
            string user = Session["user"].ToString();
            if (user == "viewer")
            {
                Response.Redirect("index.aspx");
            }

        }
        else
        {
            Response.Redirect("index.aspx");
        }

    }
    protected void ASPxGridView1_HtmlRowPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)
    {
        try
        {
            if (e.GetValue("Qty_in_stock") != null && e.GetValue("Re_Order_Level") != null)
            {
                decimal QIH = (decimal)e.GetValue("Qty_in_stock");
                decimal Reorder = decimal.Parse(e.GetValue("Re_Order_Level").ToString());
                if (QIH <= Reorder)
                {
                    bool hasError = true;
                    if (hasError)
                    {
                        e.Row.ForeColor = System.Drawing.Color.Red;
                    }
                }
            }
        }
        catch (Exception)
        {
            //Response.Redirect("404.ASPX");
        }
    }
}